package de.ludo.entities;

import java.io.Serializable;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Transient;

import de.ludo.util.Encrypt;

/**
 * This is an entity for User
 * 
 * @author L.Rother
 * 
 */
@Entity
public class User implements Serializable {

	private static final long serialVersionUID = 1L;

	@Id
	private String username;

	private String password;

	@Transient
	private Encrypt md5;

	public User() {
		super();
		this.md5 = new Encrypt("SHA-256");

	}

	public User(String username, String password) {
		super();
		this.md5 = new Encrypt("SHA-256");
		setUsername(username);
		setPassword(password);

	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = md5.do_checksum(password);
	}
}
